package com.wkq.util.transformer

import android.view.View
import androidx.viewpager2.widget.ViewPager2

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/7/28 17:58
 *
 *@Desc:  1. 旋转切换效果（RotatePageTransformer）
 */
class RotatePageTransformer : ViewPager2.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        view.apply {
            pivotX = if (position < 0) width.toFloat() else 0f
            pivotY = height * 0.5f
            rotationY = 45f * position
            alpha = 1 - kotlin.math.abs(position)
        }
    }
}
